package com.zsh.spring.aopanno;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

//增强的逻辑类
@Component
@Aspect //生成代理对象
public class UserProxy {
    //前置通知
    @Before(value = "execution(* com.zsh.spring.aopanno.User.add(..))")
    public void before(){
        System.out.println("before");
    }

    //相同切入点抽取
    @Pointcut("execution(* com.zsh.spring.aopanno.User.add(..))")
    public void pointDemo(){
    }

    //最终通知
    @After("pointDemo()")
    public void after(){
        System.out.println("final");
    }
}
